package system.student.funtion.exhibition.adminfunction.impl;

import system.student.entity.Dept;
import system.student.entity.user.Teacher;
import system.student.funtion.exhibition.adminfunction.DeptService;
import system.student.mapper.DeptMapper;
import system.student.util.MapperUtil;

import java.util.List;

public class DeptServiceImpl implements DeptService {

    private static final DeptMapper deptMapper = MapperUtil.getMapper(DeptMapper.class);
    /**
     * 添加部门
     * @param dept
     */
    @Override
    public void addDept(Dept dept) {
        deptMapper.addDept(dept);
    }

    /**
     * 查询所有部门
     * @return
     */
    @Override
    public List<Dept> findAllDept() {
        List<Dept> depts = deptMapper.findAllDept();
        return depts;
    }

    /**
     * 更新部门
     * @param dept
     */
    @Override
    public void updateDept(Dept dept) {
        deptMapper.updateDept(dept);
    }

    /**
     * 通过部门id查询所有老师
     * @param depId
     * @return
     */
    @Override
    public List<Teacher> findAllTeacherById(Long depId) {
         List<Teacher> teachers= deptMapper.findAllTeacherById(depId);
         return teachers;
    }

    /**
     * 更新老师部门
     * @param depId
     */
    @Override
    public void updateTeacherDepartment(Long depId) {
        deptMapper.updateTeacherDepartment(depId);
    }

    /**
     * 删除部门
     * @param depId
     */
    @Override
    public void deleteDept(Long depId) {
        deptMapper.deleteDept(depId);
    }
}
